﻿using Dapper;
using HR.IServices.PengIService;
using HR.Models.PengModels;
using System.Data.SqlClient;

namespace HR.Services.PengService
{
    public class UserServices:IUserServices
    {
        private readonly IConfiguration conf;
        private readonly string? conStr;

        public UserServices(IConfiguration conf)
        {
            this.conf = conf;
            conStr = this.conf["ConnectionStrings"];
        }
        //查询Users表数据  进行登录
        public List<Users> Login(string? name,string? pwd)
        {
            using (SqlConnection con = new SqlConnection(conStr))
            {
                return con.Query<Users>($"select * from users where u_name='{name}' and u_password='{pwd}'").ToList();
            }
        }
    }
}
